package com.feihong.txgw.tx_precenter;

import com.feihong.txgw.inter.contract.order.IKaikaOrderDetailContract;
import com.feihong.txgw.model.base_bean.BaseResponse;
import com.feihong.txgw.tx_model.KaikaOrderDetailMainModel;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * @Author wangziheng
 * @ProjectName txgw_app
 * @ClassName KaikaOrderDetailMainPrecenter
 * @package com.feihong.txgw.tx_precenter
 * @data 2018/5/8 10:41
 * @Describe
 * @Change
 */
public class KaikaOrderDetailMainPrecenter extends IKaikaOrderDetailContract.AbKaikaOrderDetailMainPrecenter {
    @Override
    public void cannelKaikaOrder(String orderSn, String orderType) {
        mIModel.cannelKaikaOrder(orderSn, orderType).subscribe(new Observer<BaseResponse>() {
            @Override
            public void onSubscribe(Disposable d) {
                mRxManager.register(d);
            }

            @Override
            public void onNext(BaseResponse s) {
                mIView.cannelKaikaOrderResult(s);
            }

            @Override
            public void onError(Throwable e) {
                mIView.loadDataError();
            }

            @Override
            public void onComplete() {

            }
        });
    }

    @Override
    public IKaikaOrderDetailContract.IKaikaOrderDetailMainModel getModel() {
        return KaikaOrderDetailMainModel.create();
    }

    public static KaikaOrderDetailMainPrecenter create(){
        return new KaikaOrderDetailMainPrecenter();
    }
    @Override
    public void onStart() {

    }
}
